package leetCode;

public class Toffer58 {
    public static void main(String[] args) {

    }
}

class SolutionToffer58 {
    public String reverseLeftWords(String s, int n) {
        char[] chars = s.toCharArray();
        reverse(chars,0,n-1);
        reverse(chars,n,s.length()-1);
        reverse(chars,0,s.length()-1);
        return new String(chars);

    }
    public void reverse(char[] chars,int i,int j){
        while (i<j){
            char temp=chars[i];
            chars[i]=chars[j];
            chars[j]=temp;
            i++;
            j--;
        }
    }
}